package com.wjk.blogs.dao;

import com.wjk.blogs.po.Comment;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface CommentRepository extends JpaRepository<Comment,Long> {
    List<Comment> findByBlogIdAndParentCommentNull(Long blogId, Sort sort);

   /* @Query(value = "delete from Comment c where c.blog_id = :blogId" , nativeQuery = true)
    @Modifying//delete和update时必须加上
    int deleteCommentsByBlogId(@Param("blogId") Long blogId);*/
}

